#!/bin/bash

mysql -u $1 --password=$2 -h localhost <<END
CREATE DATABASE IF NOT EXISTS $3;
GRANT ALL PRIVILEGES ON *.* TO '$1'@'%' IDENTIFIED BY '$2' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO '$1'@'localhost' IDENTIFIED BY '$2' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO '$1'@'127.0.0.1' IDENTIFIED BY '$2' WITH GRANT OPTION;
FLUSH PRIVILEGES;
END
